#include <stdio.h>
#include "company.h"
#include "staff.h"
int main(int argc, const char *argv[])
{
    // 给链表创建一个头结点，这个节点将用来指向链表的第一个节点，在带头结点的链表中，头结点就代表链表
    // 账户信息链表
    NODE *pUserList = (NODE *)malloc(sizeof(NODE));
    pUserList->shuju = NULL;
    pUserList->xiayige = NULL;

    while (1)
    {
        Log_on("../ui/log_on");
        int select; // 选择
        printf("输入你的选择:");
        scanf("%d", &select);

        switch (select)
        {
        case 1:
            if (A_Login(pUserList, "../user/administrator") == 1)
            {

                Administrator_operate("../user/message.txt");
            }
            else
            {
                printf("登陆失败,请重新输入账号或密码\n");
            }
            break;
        case 2:
            if (S_Login(pUserList, "../user/staff") == 1)
            {

                Staff_operate("../user/message.txt");
            }
            else
            {
                printf("登陆失败,请重新输入账号或密码\n");
            }
            break;
        case 3:
            zhuce();
            break;
        case 4:
            Change_password(pUserList);
            break;
        case 5:
            Retrieve_password(pUserList);
            break;
        case 6:
            printf("程序结束。\n");
            free(pUserList); // 释放链表
            exit(0);
            break;
        default:
            printf("输入的选择错误,请重新输入\n");
            break;
        }
    }

    return 0;
}